package xin.baizhiedu.Util;

import xin.baizhiedu.entity.qgJobWeek;
import xin.baizhiedu.entity.qgJobWeekMateral;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class TimeUtils {

    public static boolean minutesDifference(Date param, Date param1) {
        long times = (param.getTime() - param1.getTime());

        double hours = (double) times/(60*60*1000);

        BigDecimal a= BigDecimal.valueOf(hours);

        double waitTime = a.setScale(2, RoundingMode.HALF_UP).doubleValue();
        return waitTime > 2;

    }

    public static String Time(Date currentDate) {
        // 创建SimpleDateFormat对象，定义目标格式
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return formatter.format(currentDate);
    }

    public static List<qgJobWeek> getqgJobWeekList() {
        List<qgJobWeek> qgJobWeekList = new ArrayList<>();
        // 获取当前日期
        LocalDate today6 = LocalDate.now();
        LocalDate today5 = today6.minusDays(1); // 当前日期之前1天的日期
        LocalDate today4 = today6.minusDays(2); // 当前日期之前2天的日期
        LocalDate today3 = today6.minusDays(3); // 当前日期之前3天的日期
        LocalDate today2 = today6.minusDays(4); // 当前日期之前4天的日期
        LocalDate today1 = today6.minusDays(5); // 当前日期之前5天的日期
        LocalDate today = today6.minusDays(6); // 当前日期之前6天的日期
        qgJobWeek qgJobWeek = new qgJobWeek();
        qgJobWeek.setStartTime(String.valueOf(today));
        qgJobWeekList.add(qgJobWeek);
        qgJobWeek qgJobWeek1 = new qgJobWeek();
        qgJobWeek1.setStartTime(String.valueOf(today1));
        qgJobWeekList.add(qgJobWeek1);
        qgJobWeek qgJobWeek2 = new qgJobWeek();
        qgJobWeek2.setStartTime(String.valueOf(today2));
        qgJobWeekList.add(qgJobWeek2);
        qgJobWeek qgJobWeek3 = new qgJobWeek();
        qgJobWeek3.setStartTime(String.valueOf(today3));
        qgJobWeekList.add(qgJobWeek3);
        qgJobWeek qgJobWeek4 = new qgJobWeek();
        qgJobWeek4.setStartTime(String.valueOf(today4));
        qgJobWeekList.add(qgJobWeek4);
        qgJobWeek qgJobWeek5 = new qgJobWeek();
        qgJobWeek5.setStartTime(String.valueOf(today5));
        qgJobWeekList.add(qgJobWeek5);
        qgJobWeek qgJobWeek6 = new qgJobWeek();
        qgJobWeek6.setStartTime(String.valueOf(today6));
        qgJobWeekList.add(qgJobWeek6);
        return qgJobWeekList;
    }

    public static List<qgJobWeekMateral> getQgJobWeekMateral() {
        List<qgJobWeekMateral> qgJobWeekMaterals = new ArrayList<>();
        // 获取当前日期
        LocalDate today6 = LocalDate.now();
        LocalDate today5 = today6.minusDays(1); // 当前日期之前1天的日期
        LocalDate today4 = today6.minusDays(2); // 当前日期之前2天的日期
        LocalDate today3 = today6.minusDays(3); // 当前日期之前3天的日期
        LocalDate today2 = today6.minusDays(4); // 当前日期之前4天的日期
        LocalDate today1 = today6.minusDays(5); // 当前日期之前5天的日期
        LocalDate today = today6.minusDays(6); // 当前日期之前6天的日期
        qgJobWeekMateral qgJobWeek = new qgJobWeekMateral();
        qgJobWeek.setStartTime(String.valueOf(today));
        qgJobWeekMaterals.add(qgJobWeek);
        qgJobWeekMateral qgJobWeek1 = new qgJobWeekMateral();
        qgJobWeek1.setStartTime(String.valueOf(today1));
        qgJobWeekMaterals.add(qgJobWeek1);
        qgJobWeekMateral qgJobWeek2 = new qgJobWeekMateral();
        qgJobWeek2.setStartTime(String.valueOf(today2));
        qgJobWeekMaterals.add(qgJobWeek2);
        qgJobWeekMateral qgJobWeek3 = new qgJobWeekMateral();
        qgJobWeek3.setStartTime(String.valueOf(today3));
        qgJobWeekMaterals.add(qgJobWeek3);
        qgJobWeekMateral qgJobWeek4 = new qgJobWeekMateral();
        qgJobWeek4.setStartTime(String.valueOf(today4));
        qgJobWeekMaterals.add(qgJobWeek4);
        qgJobWeekMateral qgJobWeek5 = new qgJobWeekMateral();
        qgJobWeek5.setStartTime(String.valueOf(today5));
        qgJobWeekMaterals.add(qgJobWeek5);
        qgJobWeekMateral qgJobWeek6 = new qgJobWeekMateral();
        qgJobWeek6.setStartTime(String.valueOf(today6));
        qgJobWeekMaterals.add(qgJobWeek6);
        return qgJobWeekMaterals;
    }
}
